using Microsoft.AspNetCore.Mvc;

namespace RuoVea.ConfigApp.Test.Controllers
{
    /// <summary>
    /// 
    /// </summary>
    [ApiController]
    [Route("[controller]")]
    [EndpointGroupName("v0")]
    public class WWController : ControllerBase
    {
        private static readonly string[] Summaries = new[]
        {
            "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
        };

        private readonly ILogger<WWController> _logger;
        private readonly RuoVea.ExDto.ICurrentUser _currentUser;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="logger"></param>
        public WWController(ILogger<WWController> logger, ExDto.ICurrentUser currentUser)
        {
            _logger = logger;
            _currentUser = currentUser;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public IEnumerable<WeatherForecast> Get()
        { 
            return Enumerable.Range(1, 5).Select(index => new WeatherForecast
            {
                name= _currentUser.Name,
                Date = DateTime.Now.AddDays(index),
                TemperatureC = Random.Shared.Next(-20, 55),
                Summary = Summaries[Random.Shared.Next(Summaries.Length)]
            })
            .ToArray();
        }
    }
}
